define([
    'app'
], function(webChart) {
    webChart.directive("echartData",
        ['$compile', 'socket', 'pipe',
            function($compile, socket, pipe) {

        return {
            restrict:	"EA",
            replace:	 true,
            template:	"<span></span>",
            scope: {
            },
            controller: function ($scope, $http, $element, $attrs) {
                socket.get(
                    "xxx"
                    , function() {}
                    , function () {
                        $scope.$emit("data-updated")
                    }
                );

                function onData(data) {
                    $scope.$emit("data-updated", data);
                };
                pipe.watch('data', onData);
            }
        }

    }]);
})